<?php
/**
 * Created by PhpStorm.
 * User: Celebration-Grey
 * Date: 2017/5/7
 * Time: 13:17
 */

namespace App\Http\Classes;


use Illuminate\Support\Facades\DB;

class Admin
{
    private $admin_id;

    function __construct($admin_id)
    {
        $this -> admin_id = $admin_id;
    }

    public static function adminLogin($data){
        if(isset($data['admin_phone']) && isset($data['admin_password'])){
            $admin = DB::table('weibo_admins');
            $hash_pwd = hash('md5',$data['admin_password'].$data['admin_phone']);
            $admin = $admin -> where('admin_phone','=',$data['admin_phone'])->where('admin_password','=',$hash_pwd)->get();
            if($admin){
                return $admin[0];
            }
            else{
                return false;
            }
        }
        else{
            return false;
        }
    }
}